const Router = require('koa-router')
const { verifyToken } = require('@/utils/jwt')
const systemOptionValidate = require('@/middlewares/validateMiddlewares/systemOptionValidate')
const { verifyAuth } = require('@/middlewares/authMiddlewares/verifyAuth')
const systemOptionController = require('@/controller/systemOptionController')
const router = new Router()

/**
 * 用户列表查询配置
 */

router.get(
  '/list',
  verifyToken(),
  verifyAuth(['admin.index.setting']),
  systemOptionController.listSystemOpt
)

/**
 * 未登录用户列表查询配置
 */

router.get('/unLogin/list', systemOptionController.unLoginlistSystemOpt)

/**
 * 用户修改配置文件
 */
router.put(
  '/update',
  verifyToken(),
  verifyAuth(['admin.index.setting']),
  systemOptionValidate.setSystemOptValidate,
  systemOptionController.setSystemOpt
)

module.exports = router
